//地图的宽度
var height;
//地图的长度
var width;
//每块小图的宽度
var gheight;
//每块小图的长度
var gwidth;
//获取div的id，为输出内容做准备
var game;
//总的地图数组
var items;
//关卡的地图数组
var item;
//关卡数
var gindex=0;
var music2;
var music;
var music3;
var temp="";
var init;
var sell;
var heropoint = new Object();
var heronextpoint =new Object();
var nnextpoint = new Object();
function selectGame(){
	gindex = document.getElementById("sel1").value-1;
	loadgame();
}
function select(){
	music = document.getElementById("gamemusic1");
	music.play();
	var sels=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23];
	var sel = document.getElementById("sel1");
	for(var i in sels){
		var option = new Option();
		option.text = sels[i];
		sel.options[i] = option;
	}
	
}
function gin(){
	gindex = 0;
	loadgame();
}
function loadgame(){
	music.pause();
	music2 = document.getElementById("gamemusic2");
	music2.play();
	getmap();
	getgamemap();
}
function keydown(){
	//用于接收关于键盘按键的数据来判断是哪个按键
	e = event ? event :(window.event ? window.event : null);  
        var btn=0;  
        btn=e.keyCode||e.which||e.charCode;
	switch(btn){
		case 38: //上
		heronextpoint.x = heropoint.x;
		heronextpoint.y = heropoint.y-1;
		nnextpoint.x = heropoint.x;
		nnextpoint.y = heropoint.y-2;
		break;
		case 37:  //左
		heronextpoint.x = heropoint.x-1;
		heronextpoint.y = heropoint.y;
		nnextpoint.x = heropoint.x-2;
		nnextpoint.y = heropoint.y;
		break;
		case 40:  //下
		heronextpoint.x = heropoint.x;
		heronextpoint.y = heropoint.y+1;
		nnextpoint.x = heropoint.x;
		nnextpoint.y = heropoint.y+2;
		break;
		case 39:  //右
		heronextpoint.x = heropoint.x+1;
		heronextpoint.y = heropoint.y;
		nnextpoint.x = heropoint.x+2;
		nnextpoint.y = heropoint.y;
		break;
	}
	heromove();
}
function heromove(){
	var mvalue=item[heronextpoint.y][heronextpoint.x];
	var hero = document.getElementById(heropoint.x+''+heropoint.y);
	var img = document.getElementById(heronextpoint.x+''+heronextpoint.y);
	if(mvalue==2||mvalue==3){			//地板 目的地
		//界面更新
		hero.src="img/2.png";
		img.src="img/6.png";
		
		//地图数组更新
		item[heropoint.y][heropoint.x]=2;
		item[heronextpoint.y][heronextpoint.x]=6;
		
		heropoint.x=heronextpoint.x
		heropoint.y=heronextpoint.y
	}else if(mvalue == 4){
		var mmvalue = item[nnextpoint.y][nnextpoint.x];
		if(mmvalue==2||mmvalue==3){
			var nimg = document.getElementById(nnextpoint.x+""+nnextpoint.y);
			
			hero.src="img/2.png";
			img.src="img/6.png";
			nimg.src="img/4.png";
			
			item[heropoint.y][heropoint.x]=2;
			item[heronextpoint.y][heronextpoint.x]=6;
			item[nnextpoint.y][nnextpoint.x]=4;
			
			heropoint.x=heronextpoint.x;
			heropoint.y=heronextpoint.y;
		}
		
	}
	restM();
}
function restM(){
	var count =0;
	for(var i=0;i<init.length;i++){		
		if(!(item[init[i].y][init[i].x]==6||item[init[i].y][init[i].x]==4)){
			item[init[i].y][init[i].x]=3;
			var limg = document.getElementById(init[i].x+""+init[i].y);
			limg.src="img/3.png";
		}
		if(item[init[i].y][init[i].x]==4){
			count++;
			if(count==init.length){
				gindex++;
				alert("恭喜过关！");
				if(gindex ==23){
					music3 = document.getElementById("gamemusic3");
					music3.play();
					music2.pause();
				}
				getgamemap();
			}
		}
	}
}

function getgamemap(){
	temp ="";
	item = items[gindex];
	init = new Array();
	for(var i=0;i<item.length;i++){
		for(var j=0;j<item[i].length;j++){
			temp +="<img src='img/"+item[i][j]+".png' ' id='"+j+i+"' height='"+gheight+"px' width='"+gwidth+"px'/>"
			
			if(item[i][j] == 6){
				heropoint.x = j;
				heropoint.y = i;
			}
			
			if(item[i][j] == 3){
				var point=new Object;
				point.x = j;
				point.y = i;
				init[init.length] = point;
			}
		}
	}
	game.innerHTML =temp;
}
function getmap(){
	items=
	[
		[
			[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
			[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
			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[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
			[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
			[0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0],
			[0,0,0,0,0,1,2,3,3,3,1,0,0,0,0,0],
			[0,0,1,1,1,1,3,3,3,3,1,0,0,0,0,0],
			[0,0,1,2,2,1,1,1,4,2,1,1,1,0,0,0],
			[0,0,1,2,4,2,4,2,2,4,4,2,1,0,0,0],
			[0,0,1,2,2,4,2,4,2,2,2,2,1,0,0,0],
			[0,0,1,6,2,2,1,1,1,2,2,2,1,0,0,0],
			[0,0,1,1,1,1,1,0,0,1,1,1,1,0,0,0],
			[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
			[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
			[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
		],
		[
			[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
			[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
			[0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0],
			[0,0,1,2,2,2,2,2,2,1,0,0,0,0,0,0],
			[0,0,1,2,1,4,4,2,2,1,0,0,0,0,0,0],
			[0,0,1,2,3,3,3,1,2,1,0,0,0,0,0,0],
			[0,0,1,1,3,3,3,4,2,1,1,0,0,0,0,0],
			[0,0,0,1,2,1,1,2,4,2,1,0,0,0,0,0],
			[0,0,0,1,4,2,2,4,2,2,1,0,0,0,0,0],
			[0,0,0,1,2,2,1,6,2,2,1,0,0,0,0,0],
			[0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0],
			[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
			[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
			[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
		],
		
	];
	game = document.getElementById("game");
	//地图的宽度
	 height =590;
	//地图的长度
	 width = 700;
	//每块小图的宽度
	 gheight = height/14;
	//每块小图的长度
	 gwidth = width/16;
	 
}
